<?php
header("content-type:text/html;charset=utf-8");
mysql_connect("localhost","root","root");
mysql_select_db("hotel");
$name=$_POST["name"];
$sql="select * from user where name like '%$name%'";
$res = mysql_query($sql);
$arr = array();
while($row = mysql_fetch_assoc($res)){
    array_push($arr,$row);
}
print_r(json_encode($arr));
?>